<?php
namespace App\Rules\Admin;

class LoginRule extends \App\Rules\FormRequest
{
    /**
     * 访问权限验证
     * @return bool
     */
    public function authorize(){
        //默认是 false, 改为true
        return true;
    }

    /**
     * 验证规则
     */
    public function rules(){
        return [
            'name' => 'required|max:255',
            'password' => 'required|min:6|max:32',
        ];
    }

    /**
     * 验证消息
     * @return array|void
     */
    public function messages(){
        return [
            'name.required' => '请输入登陆帐号',
            'name.max' => '登陆帐号不能大于255个字符',
            'password.required' => '请输入登陆密码',
            'password.min' => '登陆密码不能小于6位',
            'password.max' => '登陆密码不能大于32位',
        ];
    }
}
